import { requestFunComponFiex } from '@/utils';
import { useRequest } from 'umi';
import { getManageTabSwitch } from '../mconfig';
import { getBaseUrl } from '@/services/urlconst';
import _ from 'lodash';

const baseUrl = getBaseUrl();

/** 获取资产折旧分摊列表 */
export const ManageService = (Callback: (res: Record<string, any>) => void, curRes: Record<string, any>) => {

  /**获取权限参数 */
  const queryTypeObj: Record<string, any> = getManageTabSwitch(curRes);
  const request = useRequest(
    (payload) => {
      const requestURL = `${baseUrl}/assetDeprecition/allStatics/${payload.year}/${payload.month}/${queryTypeObj.useCompanyID}`;
      return requestFunComponFiex('GET', requestURL, {});
    },
    {
      manual: true,
      onSuccess: Callback,
    },
  );
  return {
    manageServiceReturnRun: request?.run,
    manageServiceReturnLoading: request?.loading,
  };
};